package com.young.springdemo.service.director;

import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

//@Component
public class TestDecorator {

//    @PostConstruct
    public void test() throws Exception {
        Compoment compoment = new TextBoxCompoment();
        Director director = new BlaceBoardDecorator(compoment);
        Director director1 = new ScrollDirector(director);
        director1.display();


        Phone phone = new SimplePhone();//响铃
        Decorator shinePhone = new ShinePhone(phone);//闪光
        Decorator complexPhone = new JarDecorator(shinePhone);//震动
        complexPhone.ring();//响铃+闪光+震动
    }
}
